# _*_ coding : utf-8 _*_
# @Time : 2023/3/14 0014 18:30
# @Author : 菜鸟王小二
# @File : 4_urllib_quote方法
# @Project : python爬虫
import urllib.request
import urllib.parse

url = 'https://www.baidu.com/s?ie=utf-8&f=8&rsv_bp=1&rsv_idx=1&tn=baidu&wd='

headers = {
    'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.63'
}

name = urllib.parse.quote('林俊杰')
url = url + name
print(url)

request = urllib.request.Request(url=url,headers=headers)
response =  urllib.request.urlopen(request)

text = response.read().decode('utf-8')
print(text)
